import { useRoutes, Navigate } from "react-router-dom"


import Home from "../views/home/home"
import Community from "../views/community/community"
import Morevideo from "../views/morevideo/morevideo"
import Homenew from "../views/homenew/homenew"
import Homesort from "../views/homesort/homesort"
import Detailsvideo from "../views/detailsvideo/detailsvideo"
import Detailsscene from "../views/detailsscene/detailsscene"
import Detailstopic from "../views/detailstopic/detailstopic"
import Detailscourse from "../views/detailscourse/detailscourse"
import Detailsuser from "../views/detailsuser/detailsuser"
import Detailssort from "../views/detailssort/detailssort"
import Detailsnew from "../views/detailsnew/detailsnew"
import Detailstype from "../views/detailstype/detailstype"

import Morescene from "../views/morescene/morescene"
import Moretopic from "../views/moretopic/moretopic"
import Morefood from "../views/morefood/morefood"
import Morecollocation from "../views/morecollocation/morecollocation"
import Moreipvideo from "../views/moreipvideo/moreipvideo"
import Searchcontent from "../views/searchcontent/searchcontent"
import Searchlist from "../views/searchlist/searchlist"
import Allnew from "../views/allnew/allnew"
import My from "../views/my/my"
import Mycollect from "../views/mycollect/mycollect"
import Mydist from "../views/mydist/mydist"
import Myclass from "../views/myclass/myclass"

import Loginpass from "../views/loginpass/loginpass"
import Loginregister from "../views/loginregister/loginregister"
import Logincode from "../views/logincode/logincode"
import Loginforget from "../views/loginforget/loginforget"

function AppRoute() {

    let element = useRoutes([
        {
            path: "/",
            element: <Navigate to="/home" />  //重定向方式
        },
        {
            path: "home",
            element: <Home />
        },
        {
            path: "my",
            element: <My />
        },
        {
            path:"mycollect",
            element:<Mycollect />
        },
        {
            path:"mydist",
            element:<Mydist />
        },
        {
            path:"myclass",
            element:<Myclass />
        },
        {
            path: "community",
            element: <Community />
        },
        {
            path: "morevideo",
            element: <Morevideo />
        },
        {
            path: "homenew",
            element: <Homenew />
        },
        {
            path: "homesort",
            element: <Homesort />
        },
        {
            path: "detailsvideo/:id",
            element: <Detailsvideo />
        },
        {
            path: "detailsscene/:id",
            element: <Detailsscene />
        },
        {
            path: "detailstopic/:id",
            element: <Detailstopic />
        },
        {
            path: "detailscourse/:id",
            element: <Detailscourse />
        },
        {
            path: "detailssort/:id",
            element: <Detailssort />
        },
        {
            path: "detailsuser/:id",
            element: <Detailsuser />
        },
        {
            path: "detailsnew/:id",
            element: <Detailsnew />
        },
        {
            path: "detailstype/:id",
            element: <Detailstype />
        },
        {
            path: "morescene",
            element: <Morescene />
        },
        {
            path: "moretopic",
            element: <Moretopic />
        },
        {
            path: "morefood",
            element: <Morefood />
        },
        {
            path: "morecollocation",
            element: <Morecollocation />
        },
        {
            path: "moreipvideo",
            element: <Moreipvideo />
        },
        {
            path: "searchcontent",
            element: <Searchcontent />
        },
        {
            path: "searchlist/:name",
            element: <Searchlist />
        },
        {
            path: "allnew/:id",
            element: <Allnew />
        },
        {
            path:"loginpass",
            element:<Loginpass />
        },
        {
            path:"loginregister",
            element:<Loginregister />
        },
        {
            path:"logincode",
            element:<Logincode />
        },
        {
            path:"loginforget",
            element:<Loginforget />
        }


    ])

    return element;
}

export default AppRoute;